package com.meiyue.config;

import com.meiyue.bean.protocol.NetResult;
import com.meiyue.library.utils.ResultUtils;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * YuedaoApi
 * com.meiyue.config
 * Created by Chris Chen
 * 2017/9/18
 * Explain:
 */
@ControllerAdvice
public class CommonExceptionHandler {
    @ExceptionHandler(value = Exception.class)
    @ResponseBody
    public NetResult handleException(Exception e) {
        return ResultUtils.buildResult(e.getMessage());
    }
}
